package com.example.superoa.model.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.superoa.model.dao.RbiographicalDao;
import com.example.superoa.model.mappers.RhireMapper;
import com.example.superoa.model.pojos.Rbiographical;

@Service
@Transactional(rollbackFor=Exception.class)
public class RhireService {
	@Autowired
	private RhireMapper hiremapper;
	@Autowired
	private RbiographicalDao b_dao;
	
	//查询所有
	public JSONArray hirefindAlls() {
		return hiremapper.hirefindAlls();
	}	
	//根据id查询录用人信息详情
	public JSONObject hirefindById(int rofferid){
		return hiremapper.hirefindById(rofferid);
	}	
	//查看录用简历详情
	public JSONArray findBybioId(Integer reasyid) {
		return hiremapper.findBybioId(reasyid);
		
	}
	//根据id模糊查询面试人
	public JSONArray hirefindByname(String reasyname) {
		return hiremapper.hirefindByname("%"+reasyname+"%");
	}
	//发送到人事部
	public void tongzhistaff(Integer id) {
		Rbiographical Rbiographical = b_dao.findById(id).get();
		Rbiographical.setReasyguidang(1);
		b_dao.save(Rbiographical);
	}
}